package com.lago.homework2.exercise3;
/*
创建以下类：手机卡类 特征：卡类型、卡号、用户名、密码、账户余额、通话时长(分钟)、上网流量 行为：显示（卡号 + 用户名 + 当前余额）
 */
public class SIMCard {
    private String type;
    private String CardId;
    private String name;
    private String password;
    private double balance;
    private int callTime;
    private int interData;

    public SIMCard() {
    }

    public SIMCard(String type, String cardId, String name, String password, double balance, int callTime, int interData) {
        this.type = type;
        CardId = cardId;
        this.name = name;
        this.password = password;
        this.balance = balance;
        this.callTime = callTime;
        this.interData = interData;


    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCardId() {
        return CardId;
    }

    public void setCardId(String cardId) {
        CardId = cardId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        if (balance >= 0) {
            this.balance = balance;
        }else {
            System.out.println("输入的余额不合理呀！");
        }
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        if(callTime >= 0) {
            this.callTime = callTime;
        }else {
            System.out.println("输入的通话时间不合理呀！");
        }
    }

    public int getInterData() {
        return interData;
    }

    public void setInterData(int interData) {
        if (interData >= 0) {
            this.interData = interData;
        }else{
            System.out.println("输入的流量不合理呀！");
        }
    }
    public void show(){
        System.out.println("卡号："+ getCardId() + "用户名：" + getName() + "账户余额" + getBalance());
    }
}


